﻿
<ContentControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:control="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                FontSize="14"
                d:DesignHeight="600"
                d:DesignWidth="1000"
                mc:Ignorable="d">
    <Grid x:Name="LayoutRoot" Background="#FFD6D6D6">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="12"/>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" MinHeight="74" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid Visibility="{Binding ShowHeader, Converter={StaticResource BooleanToVisibilityConverter}}" Height="33">
            <Grid.Background>
                <ImageBrush ImageSource="/Corina.Lantern.Hub;component/Images/Header.png" />
            </Grid.Background>
            <Grid.Effect>
                <DropShadowEffect BlurRadius="10" ShadowDepth="0" />
            </Grid.Effect>
            <Grid Width="{StaticResource ContentMaxWidth}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
                    <TextBlock Style="{StaticResource HeaderApplicationStyle}" Text="泊银科技" />
                    <TextBlock Margin="6,0"
                               VerticalAlignment="Bottom"
                               FontWeight="Normal"
                               Foreground="{StaticResource COLOR_LIGHTDARK}"
                               Style="{StaticResource Heading5}"
                               Text="安全检测信息管理系统" />
                </StackPanel>

                <Grid Grid.Column="2" VerticalAlignment="Center">
                    <StackPanel Orientation="Horizontal">
                        <HyperlinkButton Margin="12,0"
                                         VerticalAlignment="Center"
                                         Command="{Binding LogoutCommand}"
                                         Content="账户资料"
                                         FontSize="14"
                                         Foreground="Black"
                                         Visibility="{Binding IsValid,
                                                              Converter={StaticResource BooleanToVisibilityConverter}}" />
                        <HyperlinkButton Margin="12,0"
                                         VerticalAlignment="Center"
                                         Command="{Binding LogoutCommand}"
                                         Content="退出"
                                         FontSize="14"
                                         Foreground="Black"
                                         Visibility="{Binding IsValid,
                                                              Converter={StaticResource BooleanToVisibilityConverter}}" />
                        <ToggleButton Height="16"
                                      VerticalAlignment="Center"
                                      IsChecked="{Binding FullScreen,
                                                          Mode=TwoWay}"
                                      Style="{StaticResource FullScreenButtonStyle}" />
                    </StackPanel>

                </Grid>
            </Grid>
        </Grid>

        <Grid Style="{StaticResource MainBackgroundGrid}" />

        <Grid Grid.Row="1"
              Width="{StaticResource ContentMaxWidth}"
              Visibility="{Binding ShowHeader,
                                   Converter={StaticResource BooleanToVisibilityConverter}}">
            <Image Height="45"
                   Margin="0,6"
                   HorizontalAlignment="Left"
                   Source="/Corina.Lantern.Hub;component/Images/Logo.png" />
        </Grid>

        <Grid Grid.Row="2"
              Width="{StaticResource ContentMaxWidth}"
              Visibility="{Binding IsValid,
                                   Converter={StaticResource BooleanToVisibilityConverter}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid Visibility="{Binding ShowHeader, Converter={StaticResource BooleanToVisibilityInverseConverter}}">
                <Image Height="45"
                       Margin="0,0,12,0"
                       VerticalAlignment="Top"
                       Source="/Corina.Lantern.Hub;component/Images/Logo.png" />
            </Grid>

            <Grid Grid.Column="1">
                <Grid.Effect>
                    <DropShadowEffect Direction="-90" ShadowDepth="0" />
                </Grid.Effect>
                <Grid.RowDefinitions>
                    <RowDefinition Height="39" />
                    <RowDefinition Height="Auto" MinHeight="35" />
                </Grid.RowDefinitions>
                <Border CornerRadius="5,5,0,0">
                    <Border.Background>
                        <ImageBrush ImageSource="/Corina.Lantern.Hub;component/Images/Navi_3.png" Stretch="Fill" />
                    </Border.Background>
                    <ListBox ItemsSource="{Binding TopurlCollection}"
                             SelectedItem="{Binding SelectedTopurl,
                                                    Mode=TwoWay}"
                             Style="{StaticResource TopmenuListboxStyle}" />
                </Border>
                <Border Grid.Row="1"
                        Margin="1,0"
                        CornerRadius="0,0,5,5">
                    <Border.Background>
                        <ImageBrush ImageSource="/Corina.Lantern.Hub;component/Images/Navi_2.png" Stretch="Fill" />
                    </Border.Background>
                    <ListBox ItemsSource="{Binding Navigations}"
                             SelectedItem="{Binding SelectedWeburl,
                                                    Mode=TwoWay}"
                             Style="{StaticResource SubmenuListboxStyle}" />
                </Border>
            </Grid>

        </Grid>

        <ScrollViewer Grid.Row="3"
                      BorderThickness="0"
                      ScrollViewer.VerticalScrollBarVisibility="{Binding VerticalScrollBarVisibility}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SizeChanged">
                        <ei:CallMethodAction MethodName="ContentGridSizeChanged" TargetObject="{Binding}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>

                <navigation:Frame x:Name="ContentFrame"
                                  Width="{StaticResource ContentMaxWidth}"
                                  JournalOwnership="OwnsJournal"
                                  Source="{Binding ViewUrl}"
                                  Style="{StaticResource NavContentFrameStyle}" Margin="0,12,0,0"/>

                <Grid Grid.Row="1"
                      Width="{StaticResource ContentMaxWidth}"
                      Margin="0,6">
                    <StackPanel>
                        <TextBlock Text="© 2014 泊银科技" />
                    </StackPanel>
                    <TextBlock HorizontalAlignment="Right" Visibility="{Binding IsValid, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Run Text="当前登录：" />
                        <Run Text="{Binding CurrentAccount.Account}" />
                        <Run Text="【" />
                        <Run Text="{Binding CurrentAccount.Name}" />
                        <Run Text="】" />
                    </TextBlock>
                </Grid>

            </Grid>

        </ScrollViewer>

    </Grid>
</ContentControl>
